export const getSystemTags = (): Tag[] => {
  return JSON.parse(localStorage.getItem(_Key.SystemTags) || JSON.stringify([HomeTag]))
}

export const setSystemTags = (tags: Tag[]) => {
  localStorage.setItem(_Key.SystemTags, JSON.stringify(tags))
}

export const removeSystemTags = () => {
  localStorage.removeItem(_Key.SystemTags)
}

export const getLanguage = (): SupportLanguage => {
  return (localStorage.getItem(_Key.Language) ?? navigator.language) as SupportLanguage
}

export const setLanguage = (language: string) => {
  localStorage.setItem(_Key.Language, language)
}

export const getUserId = (): string | null => {
  return localStorage.getItem(_Key.UserId)
}

export const setUserId = (userId: string) => {
  localStorage.setItem(_Key.UserId, userId)
}

export const removeUserId = () => {
  localStorage.removeItem(_Key.UserId)
}

export const getRoleId = () => {
  return localStorage.getItem(_Key.RoleId) ?? ''
}

export const setRoleId = (role: string): void => {
  localStorage.setItem(_Key.RoleId, role)
}

export const removeRoleId = () => {
  localStorage.removeItem(_Key.RoleId)
}
